<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js动画案例2--小米</title>
    <style>

    </style>
</head>
<script src="jquery-3.7.1.min.js"></script>

<body>

    <h6>爱好</h6>
    <input type="checkbox" class="one">篮球
    <input type="checkbox" class="one">篮球
    <input type="checkbox" class="one">篮球
    <input type="checkbox" class="last">全选

    <script>
        $('.last').change(function () {
            const last = $(".last").prop("checked") 
            $("input").prop("checked", last);
        })
        $('.one').change(function () {
            if ($(".one:checked").length === 3) {
                $('.last').prop("checked", true);
            } else {
                $('.last').prop("checked", false);
            }
        })

        function text(ff){
            console.log(ff);
        }
        function talk(i){
            i(66666)
        }
        talk(text)


        // $("input[type='checkbox']").prop("checked", true);
    </script>
</body>

</html>